`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: 
// Engineer: 
// 
// Create Date:    21:05:20 04/25/2014 
// Design Name: 
// Module Name:    digGrid4 
// Project Name: 
// Target Devices: 
// Tool versions: 
// Description: 
//
// Dependencies: 
//
// Revision: 
// Revision 0.01 - File Created
// Additional Comments: 
//
//////////////////////////////////////////////////////////////////////////////////
module digGrid4(digitGrid, hc, vc, blank, digX, digY, digOUT);

	input[48:1] digitGrid;  // each bit sets a square on or off in the 12x16 grid, 
									// starting with bit 48 for the top left of the grid
	
	input signed [15:0] hc,vc; // h and v scanner from VGA display
	input blank;
	input signed [15:0] digX,digY; // relative top left corner to draw digit from
	
	output digOUT; //signal to indicate to the VGA
	
	wire sq01,sq02,sq03,sq04,sq05,sq06,
		  sq07,sq08,sq09,sq10,sq11,sq12,
		  sq13,sq14,sq15,sq16,sq17,sq18,
		  sq19,sq20,sq21,sq22,sq23,sq24,
		  sq25,sq26,sq27,sq28,sq29,sq30,
		  sq31,sq32,sq33,sq34,sq35,sq36,
		  sq37,sq38,sq39,sq40,sq41,sq42,
		  sq43,sq44,sq45,sq46,sq47,sq48;
		  
		drawSq4 s_01(digitGrid[48],hc,vc,blank,digX,digY,sq01);
		drawSq4 s_02(digitGrid[47],hc,vc,blank,(digX+12'd 4),digY,sq02);
		drawSq4 s_03(digitGrid[46],hc,vc,blank,(digX+12'd 8),digY,sq03);
		drawSq4 s_04(digitGrid[45],hc,vc,blank,(digX+12'd 12),digY,sq04);
		drawSq4 s_05(digitGrid[44],hc,vc,blank,(digX+12'd 16),digY,sq05);
		drawSq4 s_06(digitGrid[43],hc,vc,blank,(digX+12'd 20),digY,sq06);
		drawSq4 s_07(digitGrid[42],hc,vc,blank,digX,(digY+12'd 4),sq07);
		drawSq4 s_08(digitGrid[41],hc,vc,blank,(digX+12'd 4),(digY+12'd 4),sq08);
		drawSq4 s_09(digitGrid[40],hc,vc,blank,(digX+12'd 8),(digY+12'd 4),sq09);
		drawSq4 s_10(digitGrid[39],hc,vc,blank,(digX+12'd 12),(digY+12'd 4),sq10);
		drawSq4 s_11(digitGrid[38],hc,vc,blank,(digX+12'd 16),(digY+12'd 4),sq11);
		drawSq4 s_12(digitGrid[37],hc,vc,blank,(digX+12'd 20),(digY+12'd 4),sq12);
		drawSq4 s_13(digitGrid[36],hc,vc,blank,digX,(digY+12'd 8),sq13);
		drawSq4 s_14(digitGrid[35],hc,vc,blank,(digX+12'd 4),(digY+12'd 8),sq14);
		drawSq4 s_15(digitGrid[34],hc,vc,blank,(digX+12'd 8),(digY+12'd 8),sq15);
		drawSq4 s_16(digitGrid[33],hc,vc,blank,(digX+12'd 12),(digY+12'd 8),sq16);
		drawSq4 s_17(digitGrid[32],hc,vc,blank,(digX+12'd 16),(digY+12'd 8),sq17);
		drawSq4 s_18(digitGrid[31],hc,vc,blank,(digX+12'd 20),(digY+12'd 8),sq18);
		drawSq4 s_19(digitGrid[30],hc,vc,blank,digX,(digY+12'd 12),sq19);
		drawSq4 s_20(digitGrid[29],hc,vc,blank,(digX+12'd 4),(digY+12'd 12),sq20);
		drawSq4 s_21(digitGrid[28],hc,vc,blank,(digX+12'd 8),(digY+12'd 12),sq21);
		drawSq4 s_22(digitGrid[27],hc,vc,blank,(digX+12'd 12),(digY+12'd 12),sq22);
		drawSq4 s_23(digitGrid[26],hc,vc,blank,(digX+12'd 16),(digY+12'd 12),sq23);
		drawSq4 s_24(digitGrid[25],hc,vc,blank,(digX+12'd 20),(digY+12'd 12),sq24);
		drawSq4 s_25(digitGrid[24],hc,vc,blank,digX,(digY+12'd 16),sq25);
		drawSq4 s_26(digitGrid[23],hc,vc,blank,(digX+12'd 4),(digY+12'd 16),sq26);
		drawSq4 s_27(digitGrid[22],hc,vc,blank,(digX+12'd 8),(digY+12'd 16),sq27);
		drawSq4 s_28(digitGrid[21],hc,vc,blank,(digX+12'd 12),(digY+12'd 16),sq28);
		drawSq4 s_29(digitGrid[20],hc,vc,blank,(digX+12'd 16),(digY+12'd 16),sq29);
		drawSq4 s_30(digitGrid[19],hc,vc,blank,(digX+12'd 20),(digY+12'd 16),sq30);
		drawSq4 s_31(digitGrid[18],hc,vc,blank,digX,(digY+12'd 20),sq31);
		drawSq4 s_32(digitGrid[17],hc,vc,blank,(digX+12'd 4),(digY+12'd 20),sq32);
		drawSq4 s_33(digitGrid[16],hc,vc,blank,(digX+12'd 8),(digY+12'd 20),sq33);
		drawSq4 s_34(digitGrid[15],hc,vc,blank,(digX+12'd 12),(digY+12'd 20),sq34);
		drawSq4 s_35(digitGrid[14],hc,vc,blank,(digX+12'd 16),(digY+12'd 20),sq35);
		drawSq4 s_36(digitGrid[13],hc,vc,blank,(digX+12'd 20),(digY+12'd 20),sq36);
		drawSq4 s_37(digitGrid[12],hc,vc,blank,digX,(digY+12'd 24),sq37);
		drawSq4 s_38(digitGrid[11],hc,vc,blank,(digX+12'd 4),(digY+12'd 24),sq38);
		drawSq4 s_39(digitGrid[10],hc,vc,blank,(digX+12'd 8),(digY+12'd 24),sq39);
		drawSq4 s_40(digitGrid[9],hc,vc,blank,(digX+12'd 12),(digY+12'd 24),sq40);
		drawSq4 s_41(digitGrid[8],hc,vc,blank,(digX+12'd 16),(digY+12'd 24),sq41);
		drawSq4 s_42(digitGrid[7],hc,vc,blank,(digX+12'd 20),(digY+12'd 24),sq42);
		drawSq4 s_43(digitGrid[6],hc,vc,blank,digX,(digY+12'd 28),sq43);
		drawSq4 s_44(digitGrid[5],hc,vc,blank,(digX+12'd 4),(digY+12'd 28),sq44);
		drawSq4 s_45(digitGrid[4],hc,vc,blank,(digX+12'd 8),(digY+12'd 28),sq45);
		drawSq4 s_46(digitGrid[3],hc,vc,blank,(digX+12'd 12),(digY+12'd 28),sq46);
		drawSq4 s_47(digitGrid[2],hc,vc,blank,(digX+12'd 16),(digY+12'd 28),sq47);
		drawSq4 s_48(digitGrid[1],hc,vc,blank,(digX+12'd 20),(digY+12'd 28),sq48);


	assign digOUT = (sq01||sq02||sq03||sq04||sq05||sq06||
							sq07||sq08||sq09||sq10||sq11||sq12||
							sq13||sq14||sq15||sq16||sq17||sq18||
							sq19||sq20||sq21||sq22||sq23||sq24||
							sq25||sq26||sq27||sq28||sq29||sq30||
							sq31||sq32||sq33||sq34||sq35||sq36||
							sq37||sq38||sq39||sq40||sq41||sq42||
							sq43||sq44||sq45||sq46||sq47||sq48);

endmodule